/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
Ext.chart.Chart.CHART_URL = '../../../ext3/resources/charts.swf';
Ext.QuickTips.init();
var _pageSize = 20;
var _title = '日统计表';
var store;
var now = new Date();
var defaultDay = now.add(Date.DAY,-1);
var loadServlet = '../../../servlet/data/RsjLoad';
var fieldName = ['pointName', 'orgName', 'pointType', 'pointType2', 'dataDate', 'voltageLevelName', 'maxVoltage', 'maxVoltageTime', 'minVoltage', 'minVoltageTime', 'avgVoltage', 'defaultTotalTime', 'aboveUpperLimitMin',
    'aboveUpperLimitNumber', 'underLowerLimitMin', 'underLowerLimitNumber', 'totalRunMin', 'rate', 'dataYear', 'dataMonth', 'dataDay', 'h00', 'h01', 'h02', 'h03', 'h04', 'h05', 'h06', 'h07', 'h08', 'h09', 'h10', 'h11',
    'h12', 'h13', 'h14', 'h15', 'h16', 'h17', 'h18', 'h19', 'h20', 'h21', 'h22', 'h23', 'pointId', 'rawRate', 'rate0', 'A', 'totalRunMinA', 'aboveUpperLimitMinA', 'underLowerLimitMinA', 'maxVoltageA', 'minVoltageA', 'B',
    'totalRunMinB', 'aboveUpperLimitMinB', 'underLowerLimitMinB', 'maxVoltageB', 'minVoltageB', 'C', 'totalRunMinC', 'aboveUpperLimitMinC', 'underLowerLimitMinC', 'maxVoltageC', 'minVoltageC', 'D', 'totalRunMinD', 'aboveUpperLimitMinD',
    'underLowerLimitMinD', 'maxVoltageD', 'minVoltageD', 'DN', 'totalRunMinDN', 'aboveUpperLimitMinDN', 'underLowerLimitMinDN', 'maxVoltageDN', 'minVoltageDN', 'DC', 'totalRunMinDC', 'aboveUpperLimitMinDC', 'underLowerLimitMinDC',
    'maxVoltageDC', 'minVoltageDC', 'rateA', 'rateB', 'rateC', 'rateD', 'rateDN', 'rateDC', 'rateTotal'];
var fieldLabel = ['测点名称', '单位名称', '测点类别', '电网类别', '日期', '电压等级<br/>(kv)', '最高电压', '最高电压时间', '最低电压', '最低电压时间', '平均电压', '故障<br/>时间（分钟）', "超上限<br/>时间（分钟）", "超上限<br/>次数",
    "超下限<br/>时间（分钟）", "超下限<br/>次数", '总时间<br/>（分钟）', '合格率（%）', '原合格率', '合格率0', 'A', 'A类总运行时间', 'A类超上限时间（分钟）', 'A类超下限时间（分钟）', 'A类最高电压', 'A类最低电压', 'B', 'B类总运行时间',
    'B类超上限时间（分钟）', 'B类超下限时间（分钟）', 'B类最高电压', 'B类最低电压', 'C', 'C类总运行时间', 'C类超上限时间（分钟）', 'C类超下限时间（分钟）', 'C类最高电压', 'C类最低电压', 'D', 'D类总运行时间', 'D类超上限时间（分钟）',
    'D类超下限时间（分钟）', 'D类最高电压', 'D类最低电压', 'D类农网数目', 'D类农网总运行时间（分钟）', 'D类农网超上限时间（分钟）', 'D类农网超下限时间（分钟）', 'D类农网最高电压', 'D类农网最低电压', 'D类城网数目', 'D类城网总运行时间（分钟）',
    'D类城网超上限时间（分钟）', 'D类城网超下限时间（分钟）', 'D类城网最高电压', 'D类城网最低电压', 'A类合格率', 'B类合格率', 'C类合格率', 'D类合格率', 'D类农网合格率', 'D类城网合格率', '综合合格率'];





var tabs = new Ext.TabPanel({
    activeTab: 0,
    plain: true,
    enableTabScroll: true,
    defaults: {autoScroll: true},
    items: [{
            title: currentOrgName + '监测点日数据',
            id: 'main-tab',
            layout: "fit",
            tbar: new Ext.Toolbar([
                {
                    text: '下级单位明细',
                    iconCls: 'icon-daytime',
                    handler: showSubOrg
                            , style: {marginLeft: '10px'}
                },
                {
                    text: '环比数据',
                    iconCls: 'icon-linkratio',
                    handler: compareRangeData
                },
                {
                    text: '合格率同比',
                    iconCls: 'icon-linkratio',
                    handler: compareSame
                },
                {
                    text: '合格率环比',
                    iconCls: 'icon-cycleratio',
                    handler: compareRange
                },
                new tlf.component.RangeCombo({
                    listeners: {
                        select: function(combo, record, index) {
                            store.baseParams.range = combo.getValue();
                        }
                    }
                }),
                new tlf.component.ReportStatusCombo({
                    listeners: {
                        select: function(combo, record, index) {
                            store.baseParams.reportStatus = combo.getValue();
                        }
                    }
                }),
                '-', dateToField, searchButton
            ])
        }
    ]
});

var hourSeries = [
    {
        yField: 'voltage',
        displayName: '电压值',
        style: {
            fillColor: 0xAAAAFF,
            borderColor: 0x3333FF,
            lineColor: 0x3333FF
        }
    }
];
var extraStyle = {
    xAxis: {
        majorGridLines: {color: 0x999999, size: 1}
    },
    yAxis: {
        titleRotation: -90
    },
    legend: {
        display: "right",
        padding: 5,
        spacing: 2,
        font: {color: 0x000000, family: "Arial", size: 12},
        border: {size: 1, color: 0x999999}
    }

};
function showSubOrg() {
    //alert(record.get('name'));
    var vid = '下级单位明细';
    storeSub = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName,
        baseParams: {cmd: 'rsjLockSubOrg', dateTo: defaultDay.format('Ymd')},
        autoLoad: true
    });

    var gridSub = new Ext.grid.GridPanel({
        store: storeSub,
        columns: [
            new Ext.grid.RowNumberer({width: 40, header: '序号'}),
            {header: fieldLabel[0], sortable: true, dataIndex: fieldName[0]},
            {header: fieldLabel[1], width: 80, sortable: true, dataIndex: fieldName[1]},
            {header: fieldLabel[2], width: 60, sortable: true, dataIndex: fieldName[2]},
            {header: fieldLabel[3], width: 60, sortable: true, dataIndex: fieldName[3]},
            {header: fieldLabel[4], width: 80, sortable: true, dataIndex: fieldName[4]},
            {header: fieldLabel[5], width: 80, sortable: true, dataIndex: fieldName[5]},
            {header: fieldLabel[6], width: 80, sortable: true, dataIndex: fieldName[6]},
            {header: fieldLabel[7], width: 100, sortable: true, dataIndex: fieldName[7]},
            {header: fieldLabel[8], width: 80, sortable: true, dataIndex: fieldName[8]},
            {header: fieldLabel[9], width: 100, sortable: true, dataIndex: fieldName[9]},
            {header: fieldLabel[10], width: 80, sortable: true, dataIndex: fieldName[10]},
            {header: fieldLabel[11], width: 80, sortable: true, dataIndex: fieldName[11]},
            {header: fieldLabel[12], width: 80, sortable: true, dataIndex: fieldName[12]},
            {header: fieldLabel[13], width: 50, sortable: true, dataIndex: fieldName[13]},
            {header: fieldLabel[14], width: 80, sortable: true, dataIndex: fieldName[14]},
            {header: fieldLabel[15], width: 50, sortable: true, dataIndex: fieldName[15]},
            {header: fieldLabel[16], width: 80, sortable: true, dataIndex: fieldName[16]}
        ],
        loadMask: true
    });

    var tab = tabs.add({
        title: vid,
        closable: true,
        id: vid,
        layout: 'fit',
        tbar: [
            {
                xtype: 'datefield',
                format: 'Y年m月d日',
                width: 150,
                value: defaultDay,
                listeners: {
                    select: function(c, date) {
                        storeSub.baseParams.dateTo = date.format('Ymd');
                    }
                }
            },
            new tlf.component.RangeCombo({
                listeners: {
                    select: function(combo, record, index) {
                        storeSub.baseParams.range = combo.getValue();
                    }
                }
            }),
            new tlf.component.ReportStatusCombo({
                listeners: {
                    select: function(combo, record, index) {
                        storeSub.baseParams.reportStatus = combo.getValue();
                    }
                }
            }),
            {
                xtype: 'button',
                text: '搜索',
                iconCls: 'icon-search',
                width: 60,
                style: {marginLeft: '20px'},
                handler: function() {
                    storeSub.reload();
                }
            }
        ]
                , items: [gridSub]
    });
    tab.show();
}

//某个单位多日日数据显示
function compareRangeData() {

    var vid = currentOrgName + "日数据环比";
    var rsjRangeDataOrgStore = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName,
        baseParams: {cmd: 'rsjLockRangeOrg', dateFrom: defaultDay.add(Date.DAY, -30).format('Ymd'), dateTo: defaultDay.format('Ymd'), start: 0, limit: _pageSize},
        autoLoad: true
    });

    var gridRangeDataOrg = new Ext.grid.GridPanel({
        store: rsjRangeDataOrgStore,
        columns: [
            new Ext.grid.RowNumberer({width: 40, header: '序号'}),
            {header: fieldLabel[0], sortable: true, dataIndex: fieldName[0]},
            {header: fieldLabel[1], width: 80, sortable: true, dataIndex: fieldName[1]},
            {header: fieldLabel[2], width: 60, sortable: true, dataIndex: fieldName[2]},
            {header: fieldLabel[3], width: 60, sortable: true, dataIndex: fieldName[3]},
            {header: fieldLabel[4], width: 80, sortable: true, dataIndex: fieldName[4]},
            {header: fieldLabel[5], width: 80, sortable: true, dataIndex: fieldName[5]},
            {header: fieldLabel[6], width: 80, sortable: true, dataIndex: fieldName[6]},
            {header: fieldLabel[7], width: 100, sortable: true, dataIndex: fieldName[7]},
            {header: fieldLabel[8], width: 80, sortable: true, dataIndex: fieldName[8]},
            {header: fieldLabel[9], width: 100, sortable: true, dataIndex: fieldName[9]},
            {header: fieldLabel[10], width: 80, sortable: true, dataIndex: fieldName[10]},
            {header: fieldLabel[11], width: 80, sortable: true, dataIndex: fieldName[11]},
            {header: fieldLabel[12], width: 80, sortable: true, dataIndex: fieldName[12]},
            {header: fieldLabel[13], width: 50, sortable: true, dataIndex: fieldName[13]},
            {header: fieldLabel[14], width: 80, sortable: true, dataIndex: fieldName[14]},
            {header: fieldLabel[15], width: 50, sortable: true, dataIndex: fieldName[15]},
            {header: fieldLabel[16], width: 80, sortable: true, dataIndex: fieldName[16]}
        ],
        loadMask: true,
        bbar: new Ext.PagingToolbar({
            pageSize: _pageSize,
            store: rsjRangeDataOrgStore,
            displayInfo: true,
            displayMsg: '显示记录：{0} - {1}   总记录：{2}',
            emptyMsg: '目前没有信息'
        })
    });

    var tab = tabs.add({
        title: vid,
        tbar: [
            {
                text: "选择开始日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayFromRangeData',
                value: defaultDay.add(Date.DAY, -30),
                format: 'Y年m月d日',
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayFrom = c.getValue();
                        rsjRangeDataOrgStore.baseParams.dayFrom = dayFrom.format('Ymd');
                    }
                }
            },
            '-',
            {
                text: "选择结束日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayToRangeData',
                format: 'Y年m月d日',
                value: defaultDay,
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayTo = c.getValue();
                        rsjRangeDataOrgStore.baseParams.dayTo = dayTo.format('Ymd');
                    }
                }
            },
            new tlf.component.RangeCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjRangeDataOrgStore.baseParams.range = combo.getValue();
                    }
                }
            }),
            new tlf.component.ReportStatusCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjRangeDataOrgStore.baseParams.reportStatus = combo.getValue();
                    }
                }
            }),
            {
                xtype: 'button',
                text: '搜索',
                iconCls: 'icon-search',
                width: 60,
                style: {marginLeft: '20px'},
                handler: function() {
                    rsjRangeDataOrgStore.reload();
                }
            }],
        closable: true,
        id: vid,
        layout: 'fit'
    });
    Ext.getCmp(vid).add(gridRangeDataOrg);
    tab.show();
}


function compareSame() {
    var vid = currentOrgName + " 日合格率同比";
    var tipRenderer = function(chart, rec, index, series) {
        var yearInfo = '日期: ' + rec.get('dataDate');
        var empInfo = '合格率' + ': '
                + rec.get('rate');
        return yearInfo + '\n' + empInfo;
    };
    var extraStyle = {
        xAxis: {
            majorGridLines: {
                color: 0x999999,
                size: 1
            }
        },
        yAxis: {
            titleRotation: -90
        }
    };
    var rsjOrgSameStore = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'dataDate',
        totalProperty: 'count',
        autoLoad: true,
        fields: ['dataDate', 'rate'],
        baseParams: {cmd: "rsjLockOrgSame", dayFrom: defaultDay.add(Date.MONTH, -12).format('Ym'), dayTo: defaultDay.format('Ymd')}
    });
    var dayFrom;
    var dayTo;
    var chartPanel = {
        xtype: 'linechart',
        store: rsjOrgSameStore,
        xField: 'dataDate',
        tipRenderer: tipRenderer,
        yField: 'rateTotal',
        extraStyle: extraStyle,
        xAxis: new Ext.chart.CategoryAxis({
            displayName: '日期',
            title: '日期'
        }),
        yAxis: new Ext.chart.NumericAxis({
            displayName: '电压合格率',
            title: '电压合格率',
            labelRenderer: Ext.util.Format.
                    numberRenderer('0,0.000')
        })
    };

    var tab = tabs.add({
        title: vid,
        //iconCls: 'icon-tab',
        //bodyStyle: 'padding: 5px',
        //html:'abc',
        tbar: [
            {
                text: "选择开始日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayFromSame',
                value: defaultDay.add(Date.MONTH, -12),
                format: 'Y年m月',
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayFrom = c.getValue();
                        rsjOrgSameStore.baseParams.dayFrom = dayFrom.format('Ym');
                    }
                }
            },
            '-',
            {
                text: "选择结束日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayToSame',
                format: 'Y年m月d日',
                value: defaultDay,
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayTo = c.getValue();
                        rsjOrgSameStore.baseParams.dayTo = dayTo.format('Ymd');
                    }
                }
            },
            new tlf.component.RangeCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjOrgSameStore.baseParams.range = combo.getValue();
                    }
                }
            }),
            new tlf.component.ReportStatusCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjOrgSameStore.baseParams.reportStatus = combo.getValue();
                    }
                }
            }),
            {
                xtype: 'button',
                text: '搜索',
                iconCls: 'icon-search',
                width: 60,
                style: {marginLeft: '20px'},
                handler: function() {
                    rsjOrgSameStore.reload();
                }
            }],
        closable: true,
        id: vid,
        layout: 'fit'
    });
    //tab.add(chartPanel);
    Ext.getCmp(vid).add(chartPanel);
    //alert('cde');
    tab.show();
}

function compareRange() {
    var vid = currentOrgName + ' 日合格率曲线';

    var tipRenderer = function(chart, rec, index, series) {
        var yearInfo = '日期: ' + rec.get('dataDate');
        var empInfo = '合格率' + ': '
                + rec.get('rate');
        return yearInfo + '\n' + empInfo;
    };
    var extraStyle = {
        xAxis: {
            majorGridLines: {
                color: 0x999999,
                size: 1
            }
        },
        yAxis: {
            titleRotation: -90
        }
    };
    var rsjRangeDataOrgStore = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName,
        baseParams: {cmd: 'rsjLockRangeOrg', dateFrom: defaultDay.add(Date.DAY, -30).format('Ymd'), dateTo: defaultDay.format('Ymd'), start: 0, limit: _pageSize},
        autoLoad: true
    });
    var dayFrom;
    var dayTo;
    var chartPanel = {
        xtype: 'linechart',
        store: rsjRangeDataOrgStore,
        xField: 'dataDate',
        tipRenderer: tipRenderer,
        yField: 'rateTotal',
        extraStyle: extraStyle,
        xAxis: new Ext.chart.CategoryAxis({
            displayName: '日期',
            title: '日期'
        }),
        yAxis: new Ext.chart.NumericAxis({
            displayName: '电压合格率',
            title: '电压合格率',
            labelRenderer: Ext.util.Format.
                    numberRenderer('0,0.000')
        })
    };

    var tab = tabs.add({
        title: vid,
        tbar: [
            {
                text: "选择开始日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayFromRate',
                value: defaultDay.add(Date.DAY, -30),
                format: 'Y年m月d日',
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayFrom = c.getValue();
                        rsjRangeDataOrgStore.baseParams.dayFrom = dayFrom.format('Ymd');
                    }
                }
            },
            '-',
            {
                text: "选择结束日期:", xtype: 'label', style: {marginLeft: '20px'}
            },
            {
                xtype: 'datefield',
                id: 'DayToRate',
                format: 'Y年m月d日',
                value: defaultDay,
                width: 150,
                listeners: {
                    select: function(c, date) {
                        dayTo = c.getValue();
                        rsjRangeDataOrgStore.baseParams.dayTo = dayTo.format('Ymd');
                    }
                }
            },
                    new tlf.component.RangeCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjRangeDataOrgStore.baseParams.range = combo.getValue();
                    }
                }
            }),
            new tlf.component.ReportStatusCombo({
                listeners: {
                    select: function(combo, record, index) {
                        rsjRangeDataOrgStore.baseParams.reportStatus = combo.getValue();
                    }
                }
            }),
            {
                xtype: 'button',
                text: '搜索',
                iconCls: 'icon-search',
                width: 60,
                style: {marginLeft: '20px'},
                handler: function() {
                    rsjRangeDataOrgStore.reload();
                }
            }],
        closable: true,
        id: vid,
        layout: 'fit'
    });

    Ext.getCmp(vid).add(chartPanel);

    tab.show();
}


var checkboxSel = new Ext.grid.CheckboxSelectionModel();
function buildWindow() {
    store = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName,
        autoLoad: true,
        baseParams: {lock:lock,cmd: 'rsjLockOrg', dateTo: defaultDay.format('Ymd'), start: 0, limit: _pageSize}
    });


    var grid = new Ext.grid.GridPanel({
        store: store,
        sm: checkboxSel,
        columns: [
            checkboxSel,
            new Ext.grid.RowNumberer({width: 40, header: '序号'}),
            //{header: fieldLabel[0], sortable: true, dataIndex: fieldName[0]},
            {header: fieldLabel[1], width: 120, sortable: true, dataIndex: fieldName[1]},
            //{header: fieldLabel[2], width: 60, sortable: true, dataIndex: fieldName[2]},
            //{header: fieldLabel[3], width: 60, sortable: true, dataIndex: fieldName[3]},
            {header: fieldLabel[4], width: 80, sortable: true, dataIndex: fieldName[4]},
//            {header: fieldLabel[5], width: 80, sortable: true, dataIndex: fieldName[5]},
//            {header: fieldLabel[17], width: 100, sortable: true,
//                renderer: function(value, metaData, record, rowIndex, colIndex, store) {
//                    var upper = record.get('aboveUpperLimitMin');
//                    var lower = record.get('underLowerLimitMin');
//                    var total = record.get('totalRunMin');
//                    var rate = 1 - (parseInt(upper) + parseInt(lower)) / parseInt(total);
//                    return rate * 100;
//                }
//            },
//            {header: fieldLabel[6], width: 80, sortable: true, dataIndex: fieldName[6]},
//            {header: fieldLabel[7], width: 100, sortable: true, dataIndex: fieldName[7]},
//            {header: fieldLabel[8], width: 80, sortable: true, dataIndex: fieldName[8]},
//            {header: fieldLabel[9], width: 100, sortable: true, dataIndex: fieldName[9]},
//            {header: fieldLabel[10], width: 80, sortable: true, dataIndex: fieldName[10]},
//            {header: fieldLabel[11], width: 80, sortable: true, dataIndex: fieldName[11]},
            {header: fieldLabel[12], width: 80, sortable: true, dataIndex: fieldName[12]},
            {header: fieldLabel[13], width: 50, sortable: true, dataIndex: fieldName[13]},
            {header: fieldLabel[14], width: 80, sortable: true, dataIndex: fieldName[14]},
            {header: fieldLabel[15], width: 50, sortable: true, dataIndex: fieldName[15]},
            {header: fieldLabel[16], width: 80, sortable: true, dataIndex: fieldName[16]},
            //{header: "原合格率", width: 100, sortable: true, dataIndex: "rawRate"},
            //{header: "合格率0", width: 100, sortable: true, dataIndex: "rate0"},

            {header: "综合合格率", width: 60, sortable: true, dataIndex: "rateTotal"},
            {header: "A类数目", width: 60, sortable: true, dataIndex: "A"},
            {header: "A类总运行<br/>时间", width: 80, sortable: true, dataIndex: "totalRunMinA"},
            {header: "A类超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinA"},
            {header: "A类超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinA"},
            {header: "A类最高<br/>电压", width: 80, sortable: true, dataIndex: "maxVoltageA"},
            {header: "A类最低电压", width: 80, sortable: true, dataIndex: "minVoltageA"},
            {header: "B类数目", width: 60, sortable: true, dataIndex: "B"},
            {header: "B类总运行<br/>时间", width: 60, sortable: true, dataIndex: "totalRunMinB"},
            {header: "B类超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinB"},
            {header: "B类超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinB"},
            {header: "B类最高<br/>电压", width: 80, sortable: true, dataIndex: "maxVoltageB"},
            {header: "B类最低<br/>电压", width: 80, sortable: true, dataIndex: "minVoltageB"},
            {header: "C类数目", width: 60, sortable: true, dataIndex: "C"},
            {header: "C类总运行<br/>时间", width: 80, sortable: true, dataIndex: "totalRunMinC"},
            {header: "C类超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinC"},
            {header: "C类超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinC"},
            {header: "C类最高<br/>电压", width: 80, sortable: true, dataIndex: "maxVoltageC"},
            {header: "C类最低<br/>电压", width: 80, sortable: true, dataIndex: "minVoltageC"},
            {header: "D类数目", width: 60, sortable: true, dataIndex: "D"},
            {header: "D类总运行<br/>时间", width: 80, sortable: true, dataIndex: "totalRunMinD"},
            {header: "D类超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinD"},
            {header: "D类超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinD"},
            {header: "D类最高<br/>电压", width: 80, sortable: true, dataIndex: "maxVoltageD"},
            {header: "D类最低<br/>电压", width: 80, sortable: true, dataIndex: "minVoltageD"},
            {header: "D类农网<br/>数目", width: 60, sortable: true, dataIndex: "DN"},
            {header: "D类农网总运行<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "totalRunMinDN"},
            {header: "D类农网超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinDN"},
            {header: "D类农网超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinDN"},
            {header: "D类农网<br/>最高电压", width: 80, sortable: true, dataIndex: "maxVoltageDN"},
            {header: "D类农网<br/>最低电压", width: 80, sortable: true, dataIndex: "minVoltageDN"},
            {header: "D类城网<br/>数目", width: 60, sortable: true, dataIndex: "DC"},
            {header: "D类城网总运行<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "totalRunMinDC"},
            {header: "D类城网超上限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "aboveUpperLimitMinDC"},
            {header: "D类城网超下限<br/>时间（分钟）", width: 90, sortable: true, dataIndex: "underLowerLimitMinDC"},
            {header: "D类城网<br/>最高电压", width: 80, sortable: true, dataIndex: "maxVoltageDC"},
            {header: "D类城网<br/>最低电压", width: 80, sortable: true, dataIndex: "minVoltageDC"},
            {header: "A类<br/>合格率", width: 60, sortable: true, dataIndex: "rateA"},
            {header: "B类<br/>合格率", width: 60, sortable: true, dataIndex: "rateB"},
            {header: "C类<br/>合格率", width: 60, sortable: true, dataIndex: "rateC"},
            {header: "D类<br/>合格率", width: 60, sortable: true, dataIndex: "rateD"},
            {header: "D类农网<br/>合格率", width: 90, sortable: true, dataIndex: "rateDN"},
            {header: "D类城网<br/>合格率", width: 90, sortable: true, dataIndex: "rateDC"}
        ],
        loadMask: true,
        bbar: new Ext.PagingToolbar({
            pageSize: _pageSize,
            store: store,
            displayInfo: true,
            displayMsg: '显示记录：{0} - {1}   总记录：{2}',
            emptyMsg: '目前没有信息'
        })
    });

    Ext.getCmp('main-tab').add(grid);
    var applicationUI = new Ext.Viewport({
        layout: "fit",
        items: [
            tabs
        ]
    });
}
Ext.onReady(buildWindow);
